<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <my-com-a @count-add="countAdd"></my-com-a>
  </div>
</body>
<script src="./lib/vue.js"></script>
<script>
  Vue.component('MyComA',{
    props: [  ],
    template: `
      <div>
        <button @click="handleClick">点我触发</button>  
      </div>
    `,
    methods:{
      handleClick(){
        console.log("点击了");
        this.$emit("count-add", 3,4);
      }
    },
    data(){
      return {

      }
    },
  })

  new Vue({
    el: "#app",
    data:{
      
    },
    methods:{
      countAdd(value1, value2){
        console.log(value1, value2);
        console.log("子组件触发函数了")
      }
    }
  })
</script>
</html>